package com.jch.integration.controller;

import com.jch.integration.server.NettyServer;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;


@RestController
@RequestMapping(value = "/nettyServer",method = RequestMethod.GET)
public class NettyController {

    @Resource
    private NettyServer nettyServer;

    @RequestMapping("/localAddress")
    public String localAddress(){
        return "Netty Server Address: " + nettyServer.getChannel().localAddress().toString();
    }

    @RequestMapping("/isOpen")
    public String isOpen(){
        return "Netty Server isOpen: " + nettyServer.getChannel().isOpen();
    }
}
